
#include "CCreditsState.h"
#include "../CGame.h"
#include "CMainMenuState.h"
#include "..\Wrappers\CSGD_Direct3D.h"
#include "..\Wrappers\CSGD_DirectInput.h"
#include "..\Wrappers\CSGD_FModManager.h"
#include "..\Wrappers\CSGD_TextureManager.h"

CCreditsState::CCreditsState()
{

}

void CCreditsState::Enter()
{
	m_nImage1= CSGD_TextureManager::GetInstance()->LoadTexture("resource/Credits_01.png");
	m_nImage2= CSGD_TextureManager::GetInstance()->LoadTexture("resource/Credits_02.png");
	m_nImage3= CSGD_TextureManager::GetInstance()->LoadTexture("resource/Credits_03.png");
	m_nImage4= CSGD_TextureManager::GetInstance()->LoadTexture("resource/Credits_04.png");
}


bool CCreditsState::Input(void)
{

	CSGD_DirectInput* pDI = CSGD_DirectInput::GetInstance();
	
	if(pDI->KeyPressed(DIK_RETURN) ||  pDI->JoystickButtonPressed(2) )
	{

		CGame::GetInstance()->ChangeState(CMainMenuState::GetInstance());

	}
	return true;
	
}

void CCreditsState::Update(float _fDT)
{
	m_scrolling-=100*_fDT;
			
}

void CCreditsState::Render(void)
{
	CSGD_Direct3D* pD3D = CSGD_Direct3D::GetInstance();
	CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();
	pD3D->Clear(0, 0, 0);
	pD3D->DeviceBegin();
	pD3D->SpriteBegin();

	//pTM->Draw(m_nCursorID, 1, m_nCursorIndex*20 + 30);

	pTM->Draw(m_nImage1,0,m_scrolling+500);
	pTM->Draw(m_nImage2,0,m_scrolling+1000);
	pTM->Draw(m_nImage3,0,m_scrolling+1500);
	pTM->Draw(m_nImage4,0,m_scrolling+2000);

	
	pD3D->GetSprite()->Flush();
	pD3D->DeviceEnd();
	pD3D->SpriteEnd();

	pD3D->Present();


}

void CCreditsState::Exit(void)
{


}

CCreditsState::~CCreditsState()
{
}